using System;
using System.Collections.Generic;
using System.Text;

using NHibernate;
using NHibernate.Data.Models;
using NHibernate.Data.Base;

namespace NHibernate.Data.Managers
{
    public partial interface IPersonManager : IManagerBase<Person, long>
    {
		// Get Methods
		IList<Person> GetByCorporation(System.Int64 corporation);
		IList<Person> GetByWinery(System.Int64 winery);
    }

    partial class PersonManager : ManagerBase<Person, long>, IPersonManager
    {
		#region Constructors
		
		public PersonManager() : base()
        {
        }
        public PersonManager(INHibernateSession session) : base(session)
        {
        }
		
		#endregion
		
        #region Get Methods

		
		public IList<Person> GetByCorporation(System.Int64 corporation)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(Person));
			
			criteria.Add(NHibernate.Criterion.Expression.Eq("Corporation", corporation));
			
			return criteria.List<Person>();
        }
		
		public IList<Person> GetByWinery(System.Int64 winery)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(Person));
			
			criteria.Add(NHibernate.Criterion.Expression.Eq("Winery", winery));
			
			return criteria.List<Person>();
        }
		
		#endregion
    }
}